const validatePass2 = (rule, value, callback) => {
    if (value === '') {
        callback(new Error('请再次输入密码'));
    } else if (value !== this.form.password) {
        callback(new Error('两次输入密码不一致!'));
    } else {
        callback();
    }
};


export const rules = {
    username       : [
        { required: true, message: '请输入 用户名', trigger: 'blur' },
        { min: 3, message: '长度最少在 3 个字符', trigger: 'blur' },
    ],
    name           : [
        { required: true, message: '请输入 姓名', trigger: 'blur' },
        { min: 3, message: '长度最少在 2 个字符', trigger: 'blur' }
    ],
    password       : [
        { required: true, message: '请输入 密码', trigger: 'blur' },
        { min: 3, message: '长度最少在 3 个字符', trigger: 'blur' }
    ],
    confirmPassword: [
        { required: true, message: '请输入 密码', trigger: 'blur' },
    ],
    role           : [
        { required: true, message: '选择角色身份', trigger: 'blur' },
    ],
    phone          : [
        { required: true, message: '请输入手机号码', trigger: 'blur' },
    ]
}

export const defaultForm = {
    name           : '',
    username       : '',
    phone          : '',
    role           : [],
    password       : '',
    confirmPassword: ''
};
